#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2019, Intel Corporation

#
# src/test/ctl_cow/TEST1 -- unit test which checks copy on writ feature
# for log pool
#

. ../unittest/unittest.sh

require_test_type medium
require_command md5sum

setup

POOL="testfile.log"

expect_normal_exit $PMEMPOOL$EXESUFFIX create -s 32MB log $DIR/$POOL

POOL_BEFORE=`md5sum -b $DIR/$POOL`

PMEMLOG_CONF="${PMEMLOG_CONF}copy_on_write.at_open=1"

expect_normal_exit ./ctl_cow$EXESUFFIX $DIR/$POOL log

POOL_AFTER=`md5sum -b $DIR/$POOL`

if [ "$POOL_BEFORE" != "$POOL_AFTER" ]
then
	fatal "$POOL_BEFORE != $POOL_AFTER"
fi

check

pass
